﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Entities
{
    public class Role : BaseEntity
    {
        private string _role_title;
        private UserPrivilegeLevels _role_level;

        /// <summary>
        /// Название роли
        /// </summary>
        public string Title
        {
            get { return _role_title; }
            set
            {
                if (String.IsNullOrWhiteSpace(value))
                {
                    throw new ArgumentException("Role title cannot be null or empty");
                }
                this.State = EntityState.Modified;
                this._role_title = value;
            }
        }

        /// <summary>
        /// Уровень привилегий роли
        /// </summary>
        public UserPrivilegeLevels RoleLevel
        {
            get { return _role_level; }
            set { _role_level = value; }
        }

        public Role()
            : base()
        {
        }

        public Role(string title, UserPrivilegeLevels level)
            : base()
        {
            this.Title = title;
            this.RoleLevel = level;
        }

        public Role(int id, string title, UserPrivilegeLevels level)
            :base(id)
        {
            this.Title = title;
            this.RoleLevel = level;
            this.State = EntityState.Unchanged;
        }
    }
}
